import axios from 'axios'
import { Indicator } from 'mint-ui'

//添加  axios   拦截器 

// Add a request interceptor  请求前做某件事的拦截器
axios.interceptors.request.use(function (config) {
  Indicator.open({
    text: '加载中...',
    spinnerType: 'fading-circle'
  });
  return config;
}, function (error) {
  // Do something with request error
  return Promise.reject(error);
});

// Add a response interceptor  得到相应的拦截器
axios.interceptors.response.use(function (response) {
  // Do something with response data
  Indicator.close()
  return response;
}, function (error) {
  // Do something with response error
  return Promise.reject(error);
});
